[DASH-1732] [templates] add build step to create javascript templates - #75
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
In the templates repo, all scripts should be runnable out of the box. Some templates have package.json files that need to be copied over to the JavaScript versions. However, we can't just copy them as-is — they still reference TypeScript. For example, they contain "start": "tsx index.ts" and TypeScript devDependencies. These need to be rewritten for JS (e.g., "start": "node index.js", remove tsx, typescript, @types/*). We should also copy over the READMEs if possible. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Build script copies READMEs without transforming TypeScript references
- The build script now rewrites README content when copying so TypeScript paths/extensions are converted to JavaScript equivalents and regenerated JavaScript READMEs contain correct
javascript/and.jsreferences.
- The build script now rewrites README content when copying so TypeScript paths/extensions are converted to JavaScript equivalents and regenerated JavaScript READMEs contain correct
Or push these changes by commenting:
@cursor push 94170f2cf4
Preview (94170f2cf4)
diff --git a/javascript/amazon-product-scraping/README.md b/javascript/amazon-product-scraping/README.md
--- a/javascript/amazon-product-scraping/README.md
+++ b/javascript/amazon-product-scraping/README.md
@@ -17,11 +17,11 @@
## QUICKSTART
-1. cd typescript/amazon-product-scraping
+1. cd javascript/amazon-product-scraping
2. npm install
3. cp .env.example .env (or create .env with required keys)
4. Add BROWSERBASE_PROJECT_ID, BROWSERBASE_API_KEY, and GOOGLE_API_KEY to .env
-5. Optionally edit SEARCH_QUERY in index.ts
+5. Optionally edit SEARCH_QUERY in index.js
6. npm start
## EXPECTED OUTPUT
@@ -49,7 +49,7 @@
## NEXT STEPS
-• Switch to direct URL: Uncomment the URL-based search block in index.ts for faster runs without LLM search actions.
+• Switch to direct URL: Uncomment the URL-based search block in index.js for faster runs without LLM search actions.
• Parameterize query: Accept SEARCH_QUERY from CLI or env for different products without editing code.
• Paginate: Extend extraction to multiple pages or increase the number of products per run.
diff --git a/javascript/company-address-finder/README.md b/javascript/company-address-finder/README.md
--- a/javascript/company-address-finder/README.md
+++ b/javascript/company-address-finder/README.md
@@ -27,7 +27,7 @@
2. npm install
3. cp .env.example .env
4. Add your Browserbase API key, Project ID, and Google Generative AI API key to .env
-5. Edit COMPANY_NAMES array in index.ts to specify which companies to process
+5. Edit COMPANY_NAMES array in index.js to specify which companies to process
6. npm start
## EXPECTED OUTPUT
diff --git a/javascript/company-value-prop-generator/README.md b/javascript/company-value-prop-generator/README.md
--- a/javascript/company-value-prop-generator/README.md
+++ b/javascript/company-value-prop-generator/README.md
@@ -16,7 +16,7 @@
## QUICKSTART
-1. cd typescript/company-value-prop-generator
+1. cd javascript/company-value-prop-generator
2. npm install
3. cp .env.example .env
4. Add required API keys/IDs to .env
diff --git a/javascript/dynamic-form-filling/README.md b/javascript/dynamic-form-filling/README.md
--- a/javascript/dynamic-form-filling/README.md
+++ b/javascript/dynamic-form-filling/README.md
@@ -21,7 +21,7 @@
1. pnpm install
2. cp .env.example .env
3. Add required API keys/IDs to .env (BROWSERBASE_PROJECT_ID, BROWSERBASE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY)
-4. Customize the `tripDetails` variable in index.ts with your own form data
+4. Customize the `tripDetails` variable in index.js with your own form data
5. Update the form URL if using a different form
6. pnpm start
diff --git a/javascript/extend-browserbase/README.md b/javascript/extend-browserbase/README.md
--- a/javascript/extend-browserbase/README.md
+++ b/javascript/extend-browserbase/README.md
@@ -23,7 +23,7 @@
## QUICKSTART
-1. cd typescript/extend-browserbase
+1. cd javascript/extend-browserbase
2. pnpm install
3. cp .env.example .env
4. Add required API keys to .env:
diff --git a/javascript/getting-started-with-browserbase/README.md b/javascript/getting-started-with-browserbase/README.md
--- a/javascript/getting-started-with-browserbase/README.md
+++ b/javascript/getting-started-with-browserbase/README.md
@@ -31,7 +31,7 @@
### TypeScript
-1. cd typescript/getting-started-with-browserbase
+1. cd javascript/getting-started-with-browserbase
2. npm install
3. cp .env.example .env
4. Add BROWSERBASE_API_KEY to .env (get it from https://browserbase.com/settings)
diff --git a/javascript/image-url-download/README.md b/javascript/image-url-download/README.md
--- a/javascript/image-url-download/README.md
+++ b/javascript/image-url-download/README.md
@@ -15,7 +15,7 @@
Docs → https://docs.stagehand.dev/basics/extract
- page.evaluate: run a JavaScript function directly inside the browser context — inherits proxy, cookies, and headers.
Docs → https://playwright.dev/docs/evaluating
-- MAX_IMAGES: configurable cap (default: 10) on how many images to download per run. Set via the `MAX_IMAGES` env var or the constant at the top of `index.ts`.
+- MAX_IMAGES: configurable cap (default: 10) on how many images to download per run. Set via the `MAX_IMAGES` env var or the constant at the top of `index.js`.
## QUICKSTART
@@ -43,7 +43,7 @@
- Empty images folder: some pages load images lazily — try scrolling the page before extraction, or increase the page load wait
- Zero images found: the page may use CSS background images not captured by `<img>` tags — adjust the extract instruction to target specific selectors
- CORS / auth-gated images: images behind login walls or strict CORS policies may fail in `page.evaluate()` — ensure you are authenticated before running the script
-- MAX_IMAGES cap: if you need more than 10 images, set `MAX_IMAGES=50` in your .env or edit the constant at the top of `index.ts`
+- MAX_IMAGES cap: if you need more than 10 images, set `MAX_IMAGES=50` in your .env or edit the constant at the top of `index.js`
- Large pages: pages with hundreds of images may slow down `extract()` — use MAX_IMAGES to limit the download set
## USE CASES
@@ -58,7 +58,7 @@
• Scroll before extracting: call `page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))` before `extract()` to trigger lazy-loaded images.
• Concurrent downloads: fan out the `page.evaluate` fetch calls with `Promise.allSettled` for faster bulk downloads.
• Metadata CSV: write a `manifest.csv` alongside the images recording original URL, filename, MIME type, byte size, and download timestamp.
-• Extend MIME support: add entries to the `MIME_TO_EXT` map at the top of `index.ts` for any formats not already covered.
+• Extend MIME support: add entries to the `MIME_TO_EXT` map at the top of `index.js` for any formats not already covered.
## HELPFUL RESOURCES
diff --git a/javascript/playwright/basic-recaptcha/README.md b/javascript/playwright/basic-recaptcha/README.md
--- a/javascript/playwright/basic-recaptcha/README.md
+++ b/javascript/playwright/basic-recaptcha/README.md
@@ -67,7 +67,7 @@
## QUICKSTART
-1. cd typescript/playwright/basic-recaptcha
+1. cd javascript/playwright/basic-recaptcha
2. pnpm install
3. cp .env.example .env
4. Add your Browserbase API key to .env
diff --git a/javascript/sec-filing-research/README.md b/javascript/sec-filing-research/README.md
--- a/javascript/sec-filing-research/README.md
+++ b/javascript/sec-filing-research/README.md
@@ -25,7 +25,7 @@
2. npm install
3. cp .env.example .env
4. Add BROWSERBASE_PROJECT_ID, BROWSERBASE_API_KEY, and GOOGLE_API_KEY to .env
-5. (Optional) Edit SEARCH_QUERY and NUM_FILINGS in index.ts
+5. (Optional) Edit SEARCH_QUERY and NUM_FILINGS in index.js
6. npm start
## EXPECTED OUTPUT
diff --git a/javascript/website-link-tester/README.md b/javascript/website-link-tester/README.md
--- a/javascript/website-link-tester/README.md
+++ b/javascript/website-link-tester/README.md
@@ -18,7 +18,7 @@
### QUICKSTART
1. **cd into the template**
- - `cd typescript/website-link-tester`
+ - `cd javascript/website-link-tester`
2. **Install dependencies**
- `npm install`
3. **Configure environment**
@@ -76,7 +76,7 @@
### TUNING BATCH SIZE & CONCURRENCY
-- **`MAX_CONCURRENT_LINKS` in `index.ts`**
+- **`MAX_CONCURRENT_LINKS` in `index.js`**
- Default: `1` → sequential link verification (works on all plans)
- Set to `> 1` → more concurrent link verifications per batch (requires higher Browserbase concurrency limits)
- **Using Semaphores for advanced control**
diff --git a/scripts/build-javascript.mjs b/scripts/build-javascript.mjs
--- a/scripts/build-javascript.mjs
+++ b/scripts/build-javascript.mjs
@@ -76,6 +76,15 @@
return pkg;
}
+function adaptReadmeForJavaScript(content) {
+ return content
+ .replaceAll("typescript/", "javascript/")
+ .replaceAll(/\.d\.ts\b/g, "__PRESERVE_D_TS__")
+ .replaceAll(/\.tsx\b/g, ".jsx")
+ .replaceAll(/\.ts\b/g, ".js")
+ .replaceAll(/__PRESERVE_D_TS__/g, ".d.ts");
+}
+
function normalizeRelativePath(filePath) {
return filePath.split(path.sep).join("/");
}
@@ -187,6 +196,15 @@
await writeFile(outputPath, `${JSON.stringify(adapted, null, 2)}\n`, "utf8");
}
+async function writeAdaptedReadme(sourcePath) {
+ const relativePath = path.relative(TYPESCRIPT_DIR, sourcePath);
+ const outputPath = path.join(JAVASCRIPT_DIR, relativePath);
+ const source = await readFile(sourcePath, "utf8");
+ const adapted = adaptReadmeForJavaScript(source);
+ await mkdir(path.dirname(outputPath), { recursive: true });
+ await writeFile(outputPath, adapted, "utf8");
+}
+
async function transpileFile(sourcePath) {
const relativePath = path.relative(TYPESCRIPT_DIR, sourcePath);
const outputPath = path
@@ -260,6 +278,8 @@
assetFiles.map(async (filePath) => {
if (path.basename(filePath) === "package.json") {
await writeAdaptedPackageJson(filePath);
+ } else if (path.basename(filePath) === "README.md") {
+ await writeAdaptedReadme(filePath);
} else {
await copyAssetFile(filePath);
}This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
…ed and rewritten with new build
8d8479e to
3173ce4
Compare
| const argv = ["scripts/build-javascript.mjs"]; | ||
| for (const name of dirs) { | ||
| argv.push("--include-template", name); | ||
| } |
There was a problem hiding this comment.
Empty API response causes CI to build all templates
Medium Severity
When fetchPlaygroundTypescriptDirNames returns an empty array (e.g., the templates API returns zero playground-runnable templates), the for loop adds no --include-template flags to argv. The build script then receives no filter arguments, causing includeTemplates.size to be 0 and falling through to the else branch that wipes javascript/ and rebuilds every template instead of none. The CI workflow would then commit all templates to the production branch, which is the opposite of the intended behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b17759b. Configure here.
| const argv = ["scripts/build-javascript.mjs"]; | ||
| for (const name of dirs) { | ||
| argv.push("--include-template", name); | ||
| } |
There was a problem hiding this comment.
Empty API response causes CI to build all templates
Medium Severity
When fetchPlaygroundTypescriptDirNames returns an empty array (e.g., the templates API returns zero playground-runnable templates), the for loop adds no --include-template flags to argv. The build script then receives no filter arguments, causing includeTemplates.size to be 0 and falling through to the else branch that wipes javascript/ and rebuilds every template instead of none. The CI workflow would then commit all templates to the production branch, which is the opposite of the intended behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b17759b. Configure here.
…itionally set for all generated JS templates
…ke updates to it twice
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a143d03. Configure here.
jay-sahnan
left a comment
There was a problem hiding this comment.
Syd, this looks great! Thank you!
Tiny NITS:
- We should add javascript/ to .gitignore
- How do we test/validate that the conversion to JS? Is this a CI job on future PRs to the dev branch?
…le places to prevent drift
…#75) * init * add a build step that turns new ts templates into js in CI * add file filter to build script * add built js templates * add exclude flag * add comments to explain build filters * add build step to run on dev branch in CI * regen templats on each pr merge * include all readme, package json and env examples in build * get paths to build js files first so that the entire repo isn't deleted and rewritten with new build * remove built js files * only build js files to production branch * remove build javascript workflow * before recursing, skip directories whose basename is in DEFAULT_EXCLUDED_DIRS * before recursing, skip directories whose basename is in DEFAULT_EXCLUDED_DIRS * if there are zero playground compatible templates, do not call build-javascript.mjs * add test-production branch support * build js templates * remove built js files * add pkg.type = module to adaptPackageJsonForJavaScript so it's unconditionally set for all generated JS templates * consolidate workflows to one plauground.yml file to remove need to make updates to it twice * write contents to test-production and production branches * use hardcoded branch names instead of unused var * add --no-verify flag to build * add stripLeadingTscBuildCommand to handle when multiple commands exist alongside tsc * add parseBuildOptions to parse CLI flags at once instead of in multiple places to prevent drift
* jaysahnan/gro-811-recaptcha-template (#28) * init commit * updating model * Add MFA Handling - TOTP Automation Template (#25) * init commit * Add MFA-handling template updates and check script - Updated MFA-handling Python and TypeScript templates - Added 'check' script to package.json for running all formatting and linting checks * addressing PR comments * jaysahnan/gro-809-manual-mfa-with-contexts (#26) * init commit * addressing PR comments * Add basic-caching template (#27) * jaysahnan/gro-812-proxies-weather-template (#29) * init commit * addressing PR comments * add go hackernews extraction template (#37) * init commit (#42) * init commit (#43) * Add cartesia-form-filling template (#47) * Add cartesia-form-filling template Adds a voice-based form-filling agent template using Cartesia's LINE SDK and Google Gemini for conducting structured questionnaires. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Replace with browserbase integration example Uses the correct cartesia-ai/line example_integrations/browserbase folder which integrates Cartesia LINE with Stagehand for voice-driven form filling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix README install instructions Use pip install . instead of pip install -r requirements.txt since pyproject.toml is used for dependencies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> * Jaysahnan/gro 926 mfa template with playwright (#48) * init commit * changed to toml * changes to readme * fixed NITS * init commit (#45) * jaysahnan/gro-954-amazon-global-price-comparision (#52) * init commit * addressing PR comment * jaysahnan/gro-955-google-trends-template (#53) * init commit * addressing PR * jaysahnan/gro-951-sec-research-template (#51) * init commit * addressing PR comments * jaysahnan/gro-950-amazon-product-fetcher-template (#50) * inti commit * formating * addressing PR comments * Exa-Browserbase-Template (#34) * init commit * added python version * Replace exa-browserbase-1 with exa-browserbase (TypeScript) * adding package.json, Exa import fix * addressing Pr comments * Migrate Python templates from Stagehand SDK v2 to v3 (#41) * Restore descriptive comments in Python v3 templates Restore important descriptive comments across all 18 Python templates: - Replace "V3 BYOB architecture" with "cloud-based browser automation" - Add "Connect to the browser via CDP" comments before sync_playwright sections - Restore Pydantic model explanations and compatibility notes - Restore caching behavior and context management documentation - Restore login/navigation sequence explanations - Keep all Pydantic models using model_json_schema() for extract All templates tested for correctness where API keys available. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Simplify Python templates to use pure Stagehand API Address PR review feedback: - Remove Playwright CDP connection from templates that only use act() and extract() - Use client.sessions.navigate() instead of page.goto() - Move session.end() to finally blocks to avoid duplicate calls - Remove unnecessary inline schema comment - Update READMEs with simplified quickstart instructions Affected templates: council-events, license-verification, form-filling, polymarket-research Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> * init commit (#54) * init commit (#55) * jaysahnan/gro-982-extend-browserbase-template (#56) * init commit * addressing PR comments * pin versions * Migrate extend-browserbase templates to Extend API v2026-02-09 (#58) - Replace processor/processorRun pattern with inline config via client.extract() - Remove getOrCreateProcessor/get_or_create_processor and EXTEND_PROCESSOR_ID - Rename config.parser to config.parseConfig, remove config.type - Update file upload: client.file.upload() → client.files.upload() - Unwrap API responses (response.id instead of response.processor.id) - Bump extend-ai SDK: TS ^0.0.18 → ^1.0.2, Python >=0.0.21 → >=1.0.0 - Update READMEs and .env.example files Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com> * Add Cerebras docs checker template (#60) * Add Cerebras docs checker Python template 4-phase documentation checker: crawl docs via parallel Stagehand BYOB workers, discover the source GitHub repo, clone it, and verify docs accuracy against source code using Cerebras tool-calling agent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add inline comments to match other Python template conventions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * Update typescript example for manual-mfa-with-contexts template (#63) * Bump JS SDK to v2.7 and Python SDK to v1.5, remove project_id from API calls (#65) * Bump JS SDK to v2.7 and Python SDK to v1.5, remove project_id from API calls - Bump @browserbasehq/sdk to ^2.7.0 in all TypeScript templates - Bump browserbase to >=1.5.0 in all Python templates - Remove projectId/project_id from bb.sessions.create(), bb.contexts.create(), and browserbaseSessionCreateParams/browserbase_session_create_params since it no longer needs to be explicitly set Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove empty object args from sessions.create() and contexts.create() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * readmes and env examples --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * feat: add smart-fetch-scraper template (Fetch API + browser fallback) (#67) * feat: add smart-fetch-scraper template — Fetch API + browser fallback * feat: add package.json for smart-fetch-scraper * feat: add .env.example for smart-fetch-scraper * feat: add README for smart-fetch-scraper * add more robust browser fallback checks * refactor code * refactor readme * update code + add example sites in readme * chore: remove package-lock.json from tracking and add .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * link directly to fetch * fix relative cd path command in quickstart * remove stagehand, just use playwright page.content when falling back to browser * Revert "remove stagehand, just use playwright page.content when falling back to browser" This reverts commit 76c0db5. * adding python example --------- Co-authored-by: Alex Qiu <alexander@browserbase.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jay Sahnan <jay@browserbase.com> * Extract image URLs with Stagehand and download images (#68) * typescript: image download template using stagehand extract to pull image urls * add Python template * rm gitignore * fix try catch handling in TS example * update gitignore * wrap file write in try/except * revert root .gitignore and uv.lock changes — out of scope for this PR Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * catch non-numeric strings set in max images and fall back to default 10 * python: missing bb api key error instead of accepting; * update ts exampel to wait until network idel, as we are extracting images * typescript match python behavior by validating urls * clean up image-url-download templates to match repo conventions --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jay Sahnan <jay@browserbase.com> * Add getting-started-with-browserbase template (Search, Fetch, Sessions) (#69) * feat: add getting-started-with-browserbase template (Search, Fetch, Sessions) * addressed PR comments * Fix broken documentation links across templates (#77) Replace 8 dead URLs with current equivalents: - docs.browserbase.com/features/sessions → /fundamentals/create-browser-session - docs.browserbase.com/integrations/playwright/python → /introduction/playwright - docs.browserbase.com/stagehand/extract → docs.stagehand.dev/v3/basics/extract - docs.stagehand.dev/basics/navigate → /v3/references/page - docs.stagehand.dev/basics/execute → /v3/basics/act - docs.stagehand.dev/python → /v3/sdk/python - docs.stagehand.dev/reference/python/overview → /v3/sdk/python - github.com/browserbase/stagehand/tree/main/examples → browserbase.com/templates * [CE-869] Add human-in-the-loop agent template (#72) * Fix Build for Agent Template (#84) * Migrate Puppeteer quickstart into templates (#80) * Add Puppeteer JavaScript quickstart template * small fix * small fix * Migrate Selenium Python quickstart into templates repo with modernized Selenium API (#78) * Migrate Selenium Python quickstart into monorepo * small readme fix * Fix Selenium quickstart session handling and waits Applied via @cursor push command --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> * Add Selenium TypeScript quickstart template (#79) * Add Selenium TypeScript quickstart template Adds typescript/selenium/quickstart-selenium/ mirroring the Python Selenium quickstart. Navigates SFMOMA, clicks interactive elements, and extracts page copy using typed Selenium WebDriver. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * addressing bug bot fixes * small fix * small readme update --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add Playwright quickstart templates for TypeScript and Python (#81) * adding playwright templates * addressing nits * fix: small readme and code fix * add toml file * fix * feat(browser-agent): adding browser agent demo from docs to templates… (#85) * feat(browser-agent): adding browser agent demo from docs to templates + prettier/eslint * update readme * Migrate templates to Model Gateway — remove separate model API keys, bump SDKs (#76) * Migrate templates to Browserbase Model Gateway * Fix Model Gateway naming and remove CUA notes from READMEs * using correct package version * updated stagehand package version to use latest * Remove BROWSERBASE_PROJECT_ID from Stagehand templates * bumped bb sdk versons * Flatten README template list for agent discoverability (#86) * Flatten README template list for agent discoverability Add a single searchable table of all 80+ templates with name, language, and one-line description so agents and humans can quickly find relevant templates without navigating subdirectories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: validate README template index * fix: align README template index with tracked templates * ci: streamline README index workflow * ci: bump checkout action * docs: group template index by language --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [DASH-1732] [templates] add build step to create javascript templates (#75) * init * add a build step that turns new ts templates into js in CI * add file filter to build script * add built js templates * add exclude flag * add comments to explain build filters * add build step to run on dev branch in CI * regen templats on each pr merge * include all readme, package json and env examples in build * get paths to build js files first so that the entire repo isn't deleted and rewritten with new build * remove built js files * only build js files to production branch * remove build javascript workflow * before recursing, skip directories whose basename is in DEFAULT_EXCLUDED_DIRS * before recursing, skip directories whose basename is in DEFAULT_EXCLUDED_DIRS * if there are zero playground compatible templates, do not call build-javascript.mjs * add test-production branch support * build js templates * remove built js files * add pkg.type = module to adaptPackageJsonForJavaScript so it's unconditionally set for all generated JS templates * consolidate workflows to one plauground.yml file to remove need to make updates to it twice * write contents to test-production and production branches * use hardcoded branch names instead of unused var * add --no-verify flag to build * add stripLeadingTscBuildCommand to handle when multiple commands exist alongside tsc * add parseBuildOptions to parse CLI flags at once instead of in multiple places to prevent drift * [DASH-2089] [templates] smart-fetch-scraper: comment about Fetch markdown/json formats (#98) * Migrate all Stagehand templates to V4 (#101) * Update TypeScript templates to Stagehand V4 * Use code mode for V4 agent templates * Harden live template outcomes * Use published Stagehand V4 package * Harden V4 templates with live outcome validation * fix: address review comments * feat: migrate Python templates to Stagehand V4 * fix: complete credentialed TypeScript template flows * feat: migrate Go template to Stagehand V4 * fix: harden reviewed template inputs * fix: avoid newest-story validation race * fix: disambiguate spoken radio answers * fix: reject uncertain spoken answers * style: align Go template with V4 docs * chore: pull Python integration from Stagehand main * fix: verify omitted GitHub application field * fix: make context and pickleball standalone * fix: address fresh v4 e2e failures * fix: preserve template Stagehand primitives * fix: retry nurse result extraction * fix: stabilize Exa application reviews * restore Stagehand primitive-first template flows * restore code-mode agent prompt behavior * simplify Exa application workflow * fix: stabilize remaining V4 template smoke tests * test templates out of band and preserve Stagehand primitives * Address final template review feedback * Harden proxy region validation * Address SDK review and remove redundant extract caveats * Address latest template review feedback * Use Model Router in remaining templates --------- Co-authored-by: Shrey Pandya <3813908+shrey150@users.noreply.github.com> * Fix missing Browserbase SDK dependencies in generated templates (#103) * fix: add Browserbase SDK dependency for download-financial-statements * fix: add Browserbase SDK dependency for job-application * Make direct template clones self-contained (#104) * fix: make source-cloned templates self-contained * fix: keep link tester concurrency safe by default * Generalize CAPTCHA solving language across templates Update documentation and code comments to use generic CAPTCHA solving terminology throughout all template files. * Rename basic-recaptcha directories to basic-captcha-solving Rename all basic-recaptcha template directories to basic-captcha-solving and update all related references in configuration files and documentation. * Remove old basic-recaptcha directories - migrated to basic-captcha-solving --------- Co-authored-by: Jay Sahnan <79011389+jay-sahnan@users.noreply.github.com> Co-authored-by: Shrey Pandya <shrey@browserbase.com> Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> Co-authored-by: Addison Huff <addison.huff@gmail.com> Co-authored-by: Alex Qiu <alexander@browserbase.com> Co-authored-by: Derek <75138022+derekmeegan@users.noreply.github.com> Co-authored-by: Jay Sahnan <jay@browserbase.com> Co-authored-by: Victor <93561983+victlue@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Syd Shields <86916890+syd-shields@users.noreply.github.com> Co-authored-by: bb <bb@browserbase.com> Co-authored-by: Shrey Pandya <3813908+shrey150@users.noreply.github.com>



This PR adds a playground-production CI workflow that builds Typescript templates into playground compatible templates as deemed by the website-api templates API.
In order to marke this Linear issue as done:
sydshields/dash-1732-turn-existing-templates-in-js-filesintodevproductionbranch, enable branch protectiondevintoproductionAdded a JS build script
build:javascript. This command runs build TS files into JS ones in CIscripts/build-javascript.mjswhich builds the JS files to /javascriptAdded a production branch for dashboard use
.github/workflows/playground-productiont.yml. This only runs on theproductionbranchscripts/playground-ci.mjswhich is ran in the playground-production workflow. It callsfetchPlaygroundTypescriptDirNamesand runsscripts/build-javascript.mjsEnsure playground compatibility by delegating templates API as source of truth
fetchPlaygroundTypescriptDirNameswhich uses the wesbite-api templates API to grab playground compatible templates from the source of truthhasStagehandUsageto ensure Stagehand is being used correctlyWhat's not included:
Note
Medium Risk
Adds new GitHub Actions workflows that generate and push commits to
production/test-productionbased on a remote templates API, which could impact release branches if the build/validation logic or API response is wrong.Overview
Adds playground-focused CI that, on
productionandtest-production, fetches the list of playground-runnable templates from the public templates API, transpiles only thosetypescript/templates intojavascript/, validates their sources, and (on pushes) auto-commits the regeneratedjavascript/tree.Introduces a local
build:javascripttranspiler (scripts/build-javascript.mjs) with filtering andpackage.jsonrewriting, plus new validation checks (parse diagnostics, Stagehand constructor requirement, and disallowingwindow.playwright.chromium.connectOverCDP). UpdatesREADME.md, adds TypeScript as a dev dependency, and addsCODEOWNERScoverage for the new workflows/scripts and generated output.Reviewed by Cursor Bugbot for commit 2a862c0. Bugbot is set up for automated code reviews on this repo. Configure here.